<template>
  <div>
    <button @click="changeTransition">Change Transition</button>
    <button @click="toggle">Toggle</button>
    <transition :name="currentTransition">
      <div v-if="show" class="content">
        Dynamic Transition Name
      </div>
    </transition>
  </div>
</template>
<script>
export default {
  data() {
    return {
      show: false,
      currentTransition: 'slide'
    };
  },
  methods: {
    changeTransition() {
      this.currentTransition = this.currentTransition === 'slide' ? 'fade' : 'slide';
      // this.show = !this.show;
    },
    toggle() {
      this.show = !this.show;
    }
  }
}
</script>
<style scoped>
.slide-enter-active,
.slide-leave-active,
.fade-enter-active,
.fade-leave-active {
  transition: all 0.5s;
}

.slide-enter,
.slide-leave-to {
  transform: translateX(100%);
}

.fade-enter,
.fade-leave-to {
  opacity: 0;
}

.content {
  width: 300px;
  height: 200px;
  background-color: #f8f8f8;
  border: 1px solid #ccc;
}
</style>